<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <button id="cls">cls</button>
  <button id="bls">bls</button>
  <img src="https://img1.baidu.com/it/u=1532016563,1998843803&fm=26&fmt=auto&gp=0.jpg" alt="苍老师" />

  <script>
    var cls = document.querySelector('#cls')
    var bls = document.querySelector('#bls')
    var img = document.querySelector('img')

    cls.onclick = function() {
      img.src ='https://img1.baidu.com/it/u=1532016563,1998843803&fm=26&fmt=auto&gp=0.jpg'  // 内置属性
      img.alt ='苍老师'
    }
    bls.onclick = function() {
      img.src ='https://img0.baidu.com/it/u=379657213,2384864330&fm=26&fmt=auto&gp=0.jpg'  
      img.alt ='波老师'
    }
  </script>
</body>
</html>